package com.example.demo;

import com.example.demo.entity.BizOrder;
import com.example.demo.entity.BizOrderProps;
import org.babyfish.jimmer.sql.filter.Filter;
import org.babyfish.jimmer.sql.filter.FilterArgs;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

import javax.servlet.http.HttpServletRequest;

@Component
public class OrderFilter implements Filter<BizOrderProps> {
    
    @Autowired
    private HttpServletRequest request;
    @Override
    public void filter(FilterArgs<BizOrderProps> args) {
        args.where(args.getTable().user().id().eq(Long.valueOf(request.getHeader("userId"))));
    }
}
